/*    */ package com.liy.cloud.auth.client.jwt;
/*    */ 
/*    */ import com.liy.cloud.auth.client.config.UserAuthConfig;
/*    */ import com.das.framework.common.extvo.LoginInfo;
/*    */ import com.das.framework.common.jwt.JWTHelper;
/*    */ import com.das.framework.common.web.exception.NoAuthorizationException;
/*    */ import io.jsonwebtoken.ExpiredJwtException;
/*    */ import io.jsonwebtoken.SignatureException;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.context.annotation.Configuration;
/*    */ import org.springframework.util.Assert;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ @Configuration
/*    */ public class JwtTokenService
/*    */ {
/*    */   @Autowired
/*    */   private UserAuthConfig userAuthConfig;
/*    */   
/*    */   public LoginInfo getInfoFromToken(String token) throws Exception {
/*    */     try {
/* 28 */       Assert.notNull(token, "401: User token is null!");
/* 29 */       return JWTHelper.getInfoFromToken(token, this.userAuthConfig.getPubKeyByte());
/* 30 */     } catch (ExpiredJwtException ex) {
/* 31 */       throw new NoAuthorizationException("User token expired!");
/* 32 */     } catch (SignatureException ex) {
/* 33 */       throw new NoAuthorizationException("User token signature error!");
/* 34 */     } catch (IllegalArgumentException ex) {
/* 35 */       throw new NoAuthorizationException("User token is null or empty!");
/*    */     } 
/*    */   }
/*    */ }


/* Location:              C:\Users\admin\Desktop\Jar\das-cloud-osc\das-cloud-osc-auth-client-1.0.0-SNAPSHOT.jar!\com\das\cloud\auth\client\jwt\JwtTokenService.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.0.7
 */